Skip to content

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Mar 10, 2025

Currently, interfaces.d.ts, a declaration file for ROS2 messages, will be generated when running npm install, which needs to require the .js files of messages and the ref-napi C++ addon gets loaded.

There could be a corner case that the ref-napi C++ addon is cross-compiled for arm arch, so loading binding.node dynamically failed on x86 platform, see details #1066.

This patch catches the error when loading the library failed, and if it happens, we will use a prebuild interfaces.d.ts instead. Meanwhiles, this patch moves out generating interfaces.d.ts file out of generate-messages command because it already executed.

Fix: #1066

@coveralls
Copy link

Coverage Status

coverage: 85.075% (-0.2%) from 85.32%
when pulling cf818a5 on minggangw:fix-1066
into cbee43b on RobotWebTools:develop.

@minggangw minggangw merged commit aee926e into RobotWebTools:develop Mar 10, 2025
10 of 11 checks passed
minggangw added a commit that referenced this pull request Mar 10, 2025
Currently, `interfaces.d.ts`, a declaration file for ROS2 messages, will be generated when running `npm install`, which needs to require the `.js` files of messages and the `ref-napi` C++ addon gets loaded.

There could be a corner case that the `ref-napi` C++ addon is cross-compiled for arm arch, so loading `binding.node` dynamically failed on x86 platform, see details #1066.

This patch catches the error when loading the library failed, and if it happens, we will use a prebuild `interfaces.d.ts` instead. Meanwhiles, this patch moves out generating `interfaces.d.ts` file out of `generate-messages` command because it already executed.

Fix: #1066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-compilation not working anymore

2 participants